package tech.aistar.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import tech.aistar.entity.Point;
import tech.aistar.mapper.CollectionsMapper;
import tech.aistar.mapper.PointMapper;
import tech.aistar.mapper.trading.GoodsMapper;
import tech.aistar.service.IPointService;

/**
 * Created by Administrator on 2019/10/16.
 */
@Controller
@Transactional
public class PointServiceImpl implements IPointService {
    @Autowired
    private PointMapper pointMapper;
    @Autowired
    private CollectionsMapper collectionsMapper;


    @Override
    public Long findPointCount(Integer postId) {
        return pointMapper.findPointCount(postId);
    }

    @Override
    public void addPoint(Point point) {
        pointMapper.addPoint(point);
    }

    @Override
    public void updatestatusTo0(Integer userId, Integer postId) {
        pointMapper.updatestatusTo0(userId,postId);
    }

    @Override
    public void updatestatusTo1(Integer userId, Integer postId) {
        pointMapper.updatestatusTo1(userId,postId);
    }

    @Override
    public Point findPointByUidAndStraId(Integer userId, Integer postId) {
        return pointMapper.findPointByUidAndStraId(userId,postId);
    }

    @Override
    public int findStarLikesCount(Integer typeId) {
        return pointMapper.findStarLikesCount(typeId);
    }

    @Override
    public void addPosts(Integer id, Integer kindId) {
        collectionsMapper.addPosts(id,kindId);
    }
}
